_isEnabled() {
let extensions = this._settings.get_strv('enabled-extensions');
- return extensions.indexOf(this.uuid) != -1;
+ return extensions.includes(this.uuid);
}
_enable() {
let extensions = this._settings.get_strv('enabled-extensions');
- if (extensions.indexOf(this.uuid) != -1)
+ if (extensions.includes(this.uuid))
return;
extensions.push(this.uuid);
// Search for an occurrence of an extension stack frame
// Start at 1 because 0 is the stack frame of this function
for (let i = 1; i < stack.length; i++) {
- if (stack[i].indexOf('/gnome-shell/extensions/') > -1) {
+ if (stack[i].includes('/gnome-shell/extensions/')) {
extensionStackLine = stack[i];
break;
}
_getLocaleLayout() {
let locale = GLib.get_language_names()[0];
- if (locale.indexOf('_') == -1)
+ if (!locale.includes('_'))
locale = DEFAULT_LOCALE;
let [found, , id] = GnomeDesktop.get_input_source_from_locale(locale);
function _listsIntersect(a, b) {
for (let itemA of a)
- if (b.indexOf(itemA) >= 0)
+ if (b.includes(itemA))
return true;
return false;
}
let excludedApps = this._folder.get_strv('excluded-apps');
let appSys = Shell.AppSystem.get_default();
let addAppId = appId => {
- if (excludedApps.indexOf(appId) >= 0)
+ if (excludedApps.includes(appId))
return;
let app = appSys.lookup_app(appId);
let appInfo = this._source.app.get_app_info();
let actions = appInfo.list_actions();
if (this._source.app.can_open_new_window() &&
- actions.indexOf('new-window') == -1) {
+ actions.includes('new-window')) {
this._newWindowMenuItem = this._appendMenuItem(_("New Window"));
this._newWindowMenuItem.connect('activate', () => {
if (this._source.app.state == Shell.AppState.STOPPED)
if (discreteGpuAvailable &&
this._source.app.state == Shell.AppState.STOPPED &&
- actions.indexOf('activate-discrete-gpu') == -1) {
+ actions.includes('activate-discrete-gpu')) {
this._onDiscreteGpuMenuItem = this._appendMenuItem(_("Launch using Dedicated Graphics Card"));
this._onDiscreteGpuMenuItem.connect('activate', () => {
if (this._source.app.state == Shell.AppState.STOPPED)
function _isWorkDay(date) {
/* Translators: Enter 0-6 (Sunday-Saturday) for non-work days. Examples: "0" (Sunday) "6" (Saturday) "06" (Sunday and Saturday). */
let days = C_('calendar-no-work', "06");
- return days.indexOf(date.getDay().toString()) == -1;
+ return !days.includes(date.getDay().toString());
}
function _getBeginningOfDay(date) {
let newEnabledComponents = Main.sessionMode.components;
newEnabledComponents.filter(
- name => this._enabledComponents.indexOf(name) == -1
+ name => !this._enabledComponents.includes(name)
).forEach(name => {
this._enableComponent(name);
});
this._enabledComponents.filter(
- name => newEnabledComponents.indexOf(name) == -1
+ name => !newEnabledComponents.includes(name)
).forEach(name => {
this._disableComponent(name);
});
let path = root.get_path();
// skip any mounts in hidden directory hierarchies
- return (path.indexOf('/.') != -1);
+ return (path.includes('/.'));
}
function isMountNonLocal(mount) {
_getAutorunSettingForType(contentType) {
let runApp = this._settings.get_strv(SETTING_START_APP);
- if (runApp.indexOf(contentType) != -1)
+ if (runApp.includes(contentType))
return AutorunSetting.RUN;
let ignore = this._settings.get_strv(SETTING_IGNORE);
- if (ignore.indexOf(contentType) != -1)
+ if (ignore.includes(contentType))
return AutorunSetting.IGNORE;
let openFiles = this._settings.get_strv(SETTING_OPEN_FOLDER);
- if (openFiles.indexOf(contentType) != -1)
+ if (openFiles.includes(contentType))
return AutorunSetting.FILES;
return AutorunSetting.ASK;
this._getPPPoESecrets(content.secrets);
break;
case 'gsm':
- if (this._hints.indexOf('pin') != -1) {
+ if (this._hints.includes('pin')) {
let gsmSetting = this._connection.get_setting_gsm();
content.title = _("PIN code required");
content.message = _("PIN code is needed for the mobile broadband device");
body = _("A password is required to connect to “%s”.".format(connection.get_id()));
break;
case 'gsm':
- if (hints.indexOf('pin') != -1) {
+ if (hints.includes('pin')) {
let gsmSetting = connection.get_setting_gsm();
title = _("PIN code required");
body = _("PIN code is needed for the mobile broadband device");
}
let userName = GLib.get_user_name();
- if (userNames.indexOf(userName) < 0)
+ if (!userNames.includes(userName))
userName = 'root';
- if (userNames.indexOf(userName) < 0)
+ if (!userNames.includes(userName))
userName = userNames[0];
this._user = AccountsService.UserManager.get_default().get_user(userName);
}
// App removed at oldIndex
- if (oldApp && newApps.indexOf(oldApp) == -1) {
+ if (oldApp && !newApps.includes(oldApp)) {
removedActors.push(children[oldIndex]);
oldIndex++;
continue;
}
// App added at newIndex
- if (newApp && oldApps.indexOf(newApp) == -1) {
+ if (newApp && !oldApps.includes(newApp)) {
addedItems.push({ app: newApp,
item: this._createAppItem(newApp),
pos: newIndex });
}
_onInhibitorLoaded(inhibitor) {
- if (this._applications.indexOf(inhibitor) < 0) {
+ if (!this._applications.includes(inhibitor)) {
// Stale inhibitor
return;
}
function callback() {
// Add extension to 'enabled-extensions' for the user, always...
let enabledExtensions = global.settings.get_strv(ExtensionSystem.ENABLED_EXTENSIONS_KEY);
- if (enabledExtensions.indexOf(uuid) == -1) {
+ if (!enabledExtensions.includes(uuid)) {
enabledExtensions.push(uuid);
global.settings.set_strv(ExtensionSystem.ENABLED_EXTENSIONS_KEY, enabledExtensions);
}
if (checkVersion && ExtensionUtils.isOutOfDate(extension)) {
extension.state = ExtensionState.OUT_OF_DATE;
} else {
- let enabled = enabledExtensions.indexOf(extension.uuid) != -1;
+ let enabled = enabledExtensions.includes(extension.uuid);
if (enabled) {
if (!initExtension(extension.uuid))
return;
_isWithinGrabbedActor(actor) {
let currentActor = this.currentGrab.actor;
while (actor) {
- if (this._actors.indexOf(actor) != -1)
+ if (this._actors.includes(actor))
return true;
if (actor == currentActor)
return true;
}
vfunc_show() {
- if (this._app && APP_WHITELIST.indexOf(this._app.get_id()) != -1) {
+ if (this._app && APP_WHITELIST.includes(this._app.get_id())) {
this._emitResponse(DialogResponse.ALLOW);
return;
}
let manager = Clutter.DeviceManager.get_default();
let device = manager.get_device(deviceId);
- if (device.get_device_name().indexOf('XTEST') < 0) {
+ if (!device.get_device_name().includes('XTEST')) {
this._lastDeviceId = deviceId;
this._syncEnabled();
}
_deferredWorkData[workId] = { 'actor': actor,
'callback': callback };
actor.connect('notify::mapped', () => {
- if (!(actor.mapped && _deferredWorkQueue.indexOf(workId) >= 0))
+ if (!(actor.mapped && _deferredWorkQueue.includes(workId)))
return;
_queueBeforeRedraw(workId);
});
logError(new Error(message), message);
return;
}
- if (_deferredWorkQueue.indexOf(workId) < 0)
+ if (!_deferredWorkQueue.includes(workId))
_deferredWorkQueue.push(workId);
if (data.actor.mapped) {
_queueBeforeRedraw(workId);
let urlId = this._findUrlAtPos(event);
if (urlId != -1) {
let url = this._urls[urlId].url;
- if (url.indexOf(':') == -1)
+ if (!url.includes(':'))
url = 'http://' + url;
Gio.app_info_launch_default_for_uri(url, global.create_app_launch_context(0, -1));
this._settings.set_string('application-id', this.id + '.desktop');
let apps = this._masterSettings.get_strv('application-children');
- if (apps.indexOf(this._canonicalId) < 0) {
+ if (!apps.includes(this._canonicalId)) {
apps.push(this._canonicalId);
this._masterSettings.set_strv('application-children', apps);
}
}
pushNotification(notification) {
- if (this.notifications.indexOf(notification) >= 0)
+ if (this.notifications.includes(notification))
return;
while (this.notifications.length >= MAX_NOTIFICATIONS_PER_SOURCE)
// If a new notification is updated while it is being hidden,
// we stop hiding it and show it again.
this._updateShowingNotification();
- } else if (this._notificationQueue.indexOf(notification) < 0) {
+ } else if (!this._notificationQueue.includes(notification)) {
// If the queue is "full", we skip banner mode and just show a small
// indicator in the panel; however do make an exception for CRITICAL
// notifications, as only banner mode allows expansion.
// If the device is being removed, destroy the padOsd.
if (device == this.padDevice) {
this.destroy();
- } else if (this._groupPads.indexOf(device) != -1) {
+ } else if (this._groupPads.includes(device)) {
// Or update the pad chooser if the device belongs to
// the same group.
this._groupPads.splice(this._groupPads.indexOf(device), 1);
}
_requestForOtherPad(pad) {
- if (pad == this.padDevice ||
- this._groupPads.indexOf(pad) == -1)
+ if (pad == this.padDevice || !this._groupPads.includes(pad))
return;
let editionMode = this._editionMode;
// If the event comes from another pad in the same group,
// show the OSD for it.
- if (this._groupPads.indexOf(event.get_source_device()) != -1) {
+ if (this._groupPads.includes(event.get_source_device())) {
this._requestForOtherPad(event.get_source_device());
return Clutter.EVENT_STOP;
}
this._updateBox(panel.center, this._centerBox);
this._updateBox(panel.right, this._rightBox);
- if (panel.left.indexOf('dateMenu') != -1)
+ if (panel.left.includes('dateMenu'))
Main.messageTray.bannerAlignment = Clutter.ActorAlign.START;
- else if (panel.right.indexOf('dateMenu') != -1)
+ else if (panel.right.includes('dateMenu'))
Main.messageTray.bannerAlignment = Clutter.ActorAlign.END;
// Default to center if there is no dateMenu
else
if (provider.defaultEnabled) {
let disabled = searchSettings.get_strv('disabled');
- return disabled.indexOf(appId) == -1;
+ return !disabled.includes(appId);
} else {
let enabled = searchSettings.get_strv('enabled');
- return enabled.indexOf(appId) != -1;
+ return enabled.includes(appId);
}
});
}
_getCompletion(text) {
- if (text.indexOf('/') != -1) {
+ if (text.includes('/')) {
return this._pathCompleter.get_completion_suffix(text);
} else {
return this._getCommandCompletion(text);
let propBlacklist = ['unlockDialog'];
for (let prop in _modes[DEFAULT_MODE]) {
if (newMode[prop] !== undefined &&
- propBlacklist.indexOf(prop) == -1)
+ !propBlacklist.includes(prop))
_modes[modeName][prop] = newMode[prop];
}
_modes[modeName]['isPrimary'] = true;
_checkConnections(network, accessPoint) {
this._connections.forEach(connection => {
if (accessPoint.connection_valid(connection) &&
- network.connections.indexOf(connection) == -1) {
+ !network.connections.includes(connection)) {
network.connections.push(connection);
}
});
if (pos != -1) {
network = this._networks[pos];
- if (network.accessPoints.indexOf(accessPoint) != -1) {
+ if (network.accessPoints.includes(accessPoint)) {
log('Access point was already seen, not adding again');
return;
}
// of different identifiers for headphones, and I could
// not find the complete list
if (sink.get_ports().length > 0)
- return sink.get_port().port.indexOf('headphone') >= 0;
+ return sink.get_port().port.includes('headphone');
return false;
}
return false;
let type = actor.meta_window.get_window_type();
- return types.indexOf(type) >= 0;
+ return types.includes(type);
}
_removeEffect(list, actor) {
_sizeChangedWindow(shellwm, actor) {
if (!actor.__animationInfo)
return;
- if (this._resizing.indexOf(actor) != -1)
+ if (this._resizing.includes(actor))
return;
let actorClone = actor.__animationInfo.clone;
let [cloneX, cloneY, cloneWidth, cloneHeight] = this._windowClone.slot;
let layout = Meta.prefs_get_button_layout();
- let side = layout.left_buttons.indexOf(Meta.ButtonFunction.CLOSE) > -1 ? St.Side.LEFT : St.Side.RIGHT;
+ let side = layout.left_buttons.includes(Meta.ButtonFunction.CLOSE) ? St.Side.LEFT : St.Side.RIGHT;
let buttonX;
let buttonY = cloneY - (button.height - button._overlap);
return;
}
- if (this._allWindows.indexOf(metaWin) == -1) {
+ if (!this._allWindows.includes(metaWin)) {
let minimizedChangedId = metaWin.connect('notify::minimized',
this._updateMinimized.bind(this));
this._allWindows.push(metaWin);